#ifndef CASSRVC_H
#define CASSRVC_H

#include "ntservice.h"
#include "logger.h"

class ServerInterface;

class CasinoService : public CNTService, public Logger
{
	public:
		CasinoService(const String& ServiceKey, const String& ServiceName,
			int32 DefaultPort);
		~CasinoService();

		virtual BOOL Install(const String& acctname, const String& password);

		virtual BOOL OnInit();
		virtual void Run();
		virtual BOOL OnUserControl(DWORD dwOpcode);
		virtual void OnStop();

		virtual ServerInterface* createServer();

		ServerInterface* getServer();

		virtual void logMsgError(const char* fmt, va_list args);
		virtual void logMsgWarning(const char* fmt, va_list args);
		virtual void logMsgInformation(const char* fmt, va_list args);

		virtual void logMsgError(const wchar_t* fmt, va_list args);
		virtual void logMsgWarning(const wchar_t* fmt, va_list args);
		virtual void logMsgInformation(const wchar_t* fmt, va_list args);

		virtual void logNumUsers(int32 Users,String strAppName);
		virtual void logStoppingCheckpoint();
		virtual bool8 logCanDeleteLogger();

	protected:
		void SetStopMsg();
		void SetLogLevel();

	private:
		void SetCurrentDirectory();
		void AdjustCasinoBase();

		static BOOL ctrlHandler(DWORD);

	protected:
		int32 port;
        PCRITICAL_SECTION	ioIni;
        char m_szModuleName[255];
		ServerInterface* serv;
       
};

inline ServerInterface*
CasinoService::getServer()
{
	return serv;
}

inline bool8
CasinoService::logCanDeleteLogger()
{
	return false;
}

#endif
